package com.project.movie.dao;

import com.project.movie.dto.ScoreData;
import com.project.movie.entities.Movies;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface MovieRepository extends JpaRepository<Movies,Long> {
    @Override
    public List<Movies> findAll();

    @Query(nativeQuery = true,value = "SELECT score AS label, COUNT(*) AS value FROM movies GROUP BY score")
    List<ScoreData> getMovieScore();
}
